﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.LongER.Framework.Utils;
using Com.LongER.Business.ZBH002;
using Com.LongER.Business.ZBH002.ZBH002DSTableAdapters;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using Com.LongER.Framework.Utils.LogUtils;


namespace Com.LongER.Business.ZBH002
{
    public class CZBH002 : ABussinessBase
    {
        private Log log = Log.GetInstance();

        /// <summary>
        /// 获取订单信息的值
        /// </summary>
        /// <returns></returns>
        public ZBH002DS.T_ORDERDataTable GetTOrderDetail(String strUserId)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_ORDERTableAdapter ta = new T_ORDERTableAdapter(connectionString);

            ZBH002DS.T_ORDERDataTable tb = ta.GetData(strUserId);
            ta.Connection.Close();
            return tb;
        }


        /// <summary>
        /// 追加订单详细信息的值
        /// </summary>
        /// <returns></returns>
        public Boolean InsertT_ORDER( String strNewONO, String strNewPINMING_CD,
                                      Decimal strNewLENGTH, Decimal strNewWIDTH, Decimal strNewHIGHTH, Decimal strNewWEIGHT,
                                      Decimal strNewCOUNTS, String strNewDANWEI_CD, 
                                      String strNewCHELIANG_XINGTAI, 
                                      String strNewZHUANGHUO_DATE, String strNewZHUANGHUO_TIME, 
                                      String strNewXIEHUO_DATE,String strNewXIEHUO_TIME, 
                                      String strNewAGENT, String strNewZHUANGHUO, String strNewXIEHUO,
                                      Decimal strNewCHENGYUN_COSTS, String strNewJIESUAN_TYPE, 
                                      String strNewAGENTNO, String strNewORDER_STATUS, String strNewORDER_END_FLG, String strNewORDER_NEW_MAN,
                                      String strNewBEIZHU)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_ORDERTableAdapter ta = new T_ORDERTableAdapter(connectionString);

            int result = ta.InstT_Order( strNewONO,  strNewPINMING_CD,
                                       strNewLENGTH,  strNewWIDTH,  strNewHIGHTH,  strNewWEIGHT,
                                       strNewCOUNTS,  strNewDANWEI_CD, 
                                       strNewCHELIANG_XINGTAI, 
                                       strNewZHUANGHUO_DATE,  strNewZHUANGHUO_TIME, 
                                       strNewXIEHUO_DATE, strNewXIEHUO_TIME, 
                                       strNewAGENT,  strNewZHUANGHUO,  strNewXIEHUO, 
                                       strNewCHENGYUN_COSTS,  strNewJIESUAN_TYPE, 
                                       strNewAGENTNO,  strNewORDER_STATUS,  strNewORDER_END_FLG,  strNewORDER_NEW_MAN,
                                       strNewBEIZHU);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }

        /// <summary>
        /// 更新订单表
        /// </summary>
        /// <param name="strUserId"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public Boolean UpdateT_Order(String strNewPINMING_CD,
                                      Decimal strNewLENGTH, Decimal strNewWIDTH, Decimal strNewHIGHTH, Decimal strNewWEIGHT,
                                      Decimal strNewCOUNTS, String strNewDANWEI_CD,
                                      String strNewCHELIANG_XINGTAI,
                                      String strNewZHUANGHUO_DATE, String strNewZHUANGHUO_TIME,
                                      String strNewXIEHUO_DATE, String strNewXIEHUO_TIME,
                                      String strNewAGENT, String strNewZHUANGHUO, String strNewXIEHUO,
                                      Decimal strNewCHENGYUN_COSTS, String strNewJIESUAN_TYPE,
                                      String strNewAGENTNO, String strNewORDER_STATUS, String strNewORDER_END_FLG, String strNewORDER_NEW_MAN,
                                      String strNewBEIZHU,
                                      String strNewONO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_ORDERTableAdapter ta = new T_ORDERTableAdapter(connectionString);

            int result = ta.UpdT_Order( strNewPINMING_CD,
                                       strNewLENGTH, strNewWIDTH, strNewHIGHTH, strNewWEIGHT,
                                       strNewCOUNTS, strNewDANWEI_CD,
                                       strNewCHELIANG_XINGTAI,
                                       strNewZHUANGHUO_DATE, strNewZHUANGHUO_TIME,
                                       strNewXIEHUO_DATE, strNewXIEHUO_TIME,
                                       strNewAGENT, strNewZHUANGHUO, strNewXIEHUO,
                                       strNewCHENGYUN_COSTS, strNewJIESUAN_TYPE,
                                       strNewAGENTNO, strNewORDER_STATUS, strNewORDER_END_FLG, strNewORDER_NEW_MAN,
                                       strNewBEIZHU,
                                       strNewONO);
            if (result <= 0) return false;

            ta.Connection.Close();

            if (result > 0) return true;

            return false;
        }

        /// <summary>
        /// 删除用户信息
        /// </summary>
        /// <returns></returns>
        public Boolean DeleteT_Order(String strONO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_ORDERTableAdapter ta = new T_ORDERTableAdapter(connectionString);

            int result = ta.DltT_Order(strONO);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }


    }
}
